package com.bw.coll;

import com.bw.bean.Emp;
import com.bw.service.EmpService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class EmpColl {

    @Autowired
    EmpService emp;
    //1.1按照第二大类交易额展示饼状图
    @RequestMapping("/list1")
    public Map getLIst1(){
        List<Emp> list1 = emp.getList1();
        return SugarUtil.getPieData(list1);
    }

    //1.2按品牌交易额 展示柱状图
    @RequestMapping("/list2")
    public Map getLIst2(){
        List<Emp> list1 = emp.getList2();
        return SugarUtil.getBarData(list1);
    }


    //1.4按SPU 分组，订单金额  轮播表格展示
    @RequestMapping("/list3")
    public String getLIst3(){
        List<Emp> list3 = emp.getList3();
        List<String> list=new ArrayList<>();
        list.add("部门");
        list.add("金额");
        return SugarUtil.getTablePlayData(list,list3);
    }

    //1.3总成交金额的 数字翻牌展示
    @RequestMapping("/list4")
    public Map getLIst4(){
        Double list4 = emp.getList4();
        HashMap<Object, Object> map = new HashMap<>();
        map.put("status",0);
        map.put("data",list4);
        return map;
    }




}
